package com.zxs.constant;

/**
 * 常量类
 */
public class Constants {
    //响应前端成功，Result 中的code值为0
    public static final Integer SUCCESS = 0;

    //响应前端成功，Result 中的code值为-2  支付超时
    public static final Integer TIMEOUT = -2;

    //响应前端失败，code值为-1
    public static final Integer ERROR = -1;

    //用户登录的session属性名
    public static final String LOGIN_USER = "login_user";

    //redis中商品缓存key的前缀： key = 前缀 + 商品id
    public static final String REDIS_GOODS = "redis:goods:";
    //redis中商品库存key的前缀： key = 前缀 + 商品id
    public static final String REDIS_STORE = "redis:store:";
    //redis中用户的占位key的前缀： key=前缀+商品id+":"+用户id
    public static final String REDIS_HOLD = "redis:hold:";
    //redis中查询下单结果的前缀： key=前缀+商品id+":"+用户id
    public static final String REDIS_RESULT = "redis:result:";
    //限流常量
    public static final int MAX_LIMIT = 1000;


    //--------------------rabbit config-------------------------
    //下订单的交换机
    public static final String EXCHANGE_NAME_ORDER = "exchange.seckill.order";
    //下订单的队列
    public static final String QUEUE_NAME_ORDER = "queue.seckill.order";
    //下订单的交换机和队列的绑定路由key
    public static final String ROUTING_KEY_ORDER = "seckill.order";


    //--------------------rabbit delay message config-------------------------
    //正常的三要素：交换机名字、队列名字、路由键名字
    public static final String EXCHANGE_DELAY_NAME = "exchange.order.delay";
    public static final String QUEUE_DELAY_NAME = "queue.order.delay";
    public static final String ROUTING_KEY_DELAY_NAME = "order.delay";
    //--------------------3分钟订单关闭----------------------------
    //public static final int DELAY_TIME = 3 * 60 * 1000;
    public static final int DELAY_TIME = 40 * 1000; // 40秒关闭订单

    //-------------------------订单状态----------------------------
    public static final int ORDER_STATUS_WAITPAY = 0; //待支付
    public static final int ORDER_STATUS_PAY = 1;  // 已支付
    public static final int ORDER_STATUS_TIMEOUT = 2;  // 超时




}